import logging


def setup_logging(level: str = 'INFO') -> logging.Logger:
    logger = logging.getLogger('monitor')
    if logger.handlers:
        # Already configured
        return logger
    logger.setLevel(getattr(logging, level.upper(), logging.INFO))
    handler = logging.StreamHandler()
    formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
    handler.setFormatter(formatter)
    logger.addHandler(handler)
    return logger


